<!--#include virtual="/common/Config.asp" -->
<!--#include virtual="/common/conn.asp" -->
<!--#include virtual="/common/function.asp" -->
<!--#include virtual="/Common/MD5.asp"-->
<%
Dim UserName
dim new_password
dim old_password_md5
Dim UserEmail
If Request.ServerVariables ("Request_Method")="POST" Then

	UserName = reform("get_u")
	UserEmail= reform("get_e")

	If Trim(UserName)="" Then 
		alertBox "请输入用户名!","javascript:history.go(-1)"
	End If
	If Trim(UserEmail)="" Then 
		alertBox "请输入邮箱地址","javascript:history.go(-1)"
	End If
	
	Sql = "SELECT a.UserID,a.UserName,a.UserEmail FROM Member a   WHERE a.UserName = '" & UserName & "' "

	Array_List = GetRsRows(Sql)


	If IsArray(Array_List)=False  Then
		alertBox "用户名不存在","javascript:history.go(-1)"
	Else
		
		new_password = GetRndString(8)
		new_password = MD5(new_password)
		If UserEmail<>Array_List(2,0) Then 
			AlertBox "您留的邮箱不正确,!","javascript:history.go(-1)"
		End If 
		UserEmail	 = Array_List(2,0)

		Call Send_Mail()

		AlertBox "密码已发送到您的邮箱,请查收!","/member/"
	End If
	Call conn_close()
End If 


Sub Update_Password(new_password)
	Sql = "Update Member SET UserPassword='"&new_password&"' WHERE UserName='"&UserName&"'"
	conn.execute(Sql)
End Sub 

Sub Send_Mail()
	dim message
	message="<b>取回密码</b><BR><BR>"
	message=message&"这是你的新密码: "& new_password &"<BR><BR>"
	message=message&"<BR><BR><BR>"
	

	Body=""
	CR=Chr(10)&Chr(13)
	
	Body=Body& "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">"&CR
	Body=Body& "<html xmlns=""http://www.w3.org/1999/xhtml"">"&CR
	Body=Body& "<head>"&CR
	Body=Body& "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"" />"&CR
	'Body=Body& "<title>取回密码fggg</title>"&CR
	Body=Body& "</head>"&CR
	Body=Body& "<body>"&CR
	Body = Body & Session("Get_Password") & "：您好！<br><br>" & CR 
	Body = Body & message & CR
	Body = Body & "&nbsp;&nbsp;&nbsp;<a href='http://www.hainanok.com'>海南网</a>&nbsp;&nbsp;&nbsp;" & CR
	Body = Body & "<br>" & CR
	
	Body=Body& "</body>"&CR
	Body=Body& "</html>"&CR


	Call SendMail(UserEmail,UserName,"webmaster@hainanok.com","海南网","取回密码",Body,"")
	
	'SendMail(ToMail,ToName,FromMail,FromName,Subject,Body,Attachment)
End Sub 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="海南网" />
<meta name="Keywords" content="海南网,海南办事指南,办事指南" />
<title>海南网</title>
<link href="/skin/09/index.css" rel="stylesheet" type="text/css" media="screen" />
<script language="javascript">
function get_pwd()
{
	var username = document.getElementById("get_u").value;
	if (username=="")
	{
		alert("请输入用户名!");
		return false;
	}
	if (username.length>20)
	{
		alert("用户名长度不能超过20个字符!");
		return false;
		
	}

	var useremail = document.getElementById("get_e").value;
	if (useremail!=""){
		if(IsEmail(useremail)==false){	
			alert("请输入正确的E-mail址!");
			return false;
		}
	}else	{
		alert("请输入电子邮件");
		return false;
	}
	
	return true;
}

function IsEmail(str){ 
	res = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
	var re = new RegExp(res); 
	return !(str.match(re) == null); 
} 
</script>
</head>
<body >
<!--#include Virtual="/include/Head.asp" -->
<div class="top"></div>
<table width="940" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td>取回密码</td>
  </tr>
    <tr>
      <td><table width="100%" cellpadding="0" cellspacing="0" class="sbj8">
        <tr>
          <td valign="center" align="middle" colspan="4" height="1"><table bordercolor="#111111" cellspacing="0" cellpadding="0" width="100%" border="0">
            <tbody>
              <tr>
                <td bgcolor="#eaeaea" height="1"></td>
                </tr>
              </tbody>
          </table></td>
        </tr>
		<form action="" method="post" name="get_form" id="get_form" onsubmit="return get_pwd();">
        <tr>
          <td valign="center" align="left" width="94" height="30">用户名：</td>
          <td width="463" height="21" colspan="3" align="left" valign="center"><input type="text" id="get_u" size="20"  name="get_u" maxlength="20" /></td>
        </tr>
        <tr>
          <td valign="center" align="left" width="94" height="30">邮箱地址：</td>
          <td height="21" colspan="3" align="left" valign="center"><input type="text" id="get_e" name="get_e" maxlength="50" size="16" value="" /></td>
        </tr>
        <tr>
          <td valign="center" align="middle" colspan="4" height="58"><input  type="submit" value="确定 " name="submit" />
            <input type="reset" value="重置  " name="reset" /></td>
        </tr>
		</form>
      </table></td>
    </tr>
</table>
<!--/left-->
  <!--right-->
  <!--/right-->
</div>
<!--/d-->
<!--申请友情链接-->
<!--/e-->
</body>
</html>

<% Call Conn_Close() %>